import os

basedir = os.path.abspath(os.path.dirname(__name__))

if not os.path.exists('db'):
    os.mkdir(os.path.join(basedir, 'db'))


class Config(object):
    FLASK_WEB_NAME = '后台管理'
    SECRET_KEY = os.environ.get('SECRET_KEY') or '!@#$%^&*12345678'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    DEBUG_TB_INTERCEPT_REDIRECTS = False
    POST_PRE_PAGE = 10


class DevelopmentConfig(Config):
    SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(
        basedir, 'db/app-dev.db')


class ProductionConfig(Config):
    SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'db/app.db')


config = {
    'development': DevelopmentConfig,
    'production': ProductionConfig,
}
